
include('graphics.node');

new_class(
  'graphics.SpriteNode',
  function(sprite_url, x, y, scaleX, scaleY, angle, z) {
    // Call parent constructor.
    graphics.Node.call(this, x, y, scaleX, scaleY, angle, z);
    // Load the sprite.
    var img = new Image;
    img.src = sprite_url;
    this._image = img;
  },
  {
    draw: function(d) {
      d.drawImage(this._image, -this._image.width/2, -this._image.height/2);
    }
  },
  graphics.Node);